
<template>
  <div>
    <el-input placeholder="请输入要加密的信息" v-model="message" type="textarea"></el-input>
    <el-input placeholder="请输入要解密的信息" v-model="scriptMessage" type="textarea"></el-input>
    <el-button @click="encrypt">加密</el-button>
    <el-button @click="decrypt">解密</el-button>
    <el-button @click="clear">清空</el-button>
  </div>
</template>
<script setup lang="ts">
import * as crypto from "./crypto";
const message = ref('')//要加密的信息
const scriptMessage = ref('')//要解密的信息

const encrypt = () => {
  const result = crypto.default.encrypt(message.value)
  console.log(result)
  scriptMessage.value = result
}
const decrypt = () => {
  const result = crypto.default.decrypt(scriptMessage.value)
  console.log(result)
  message.value = result
}
const clear = () => {
  message.value = ''
  scriptMessage.value = ''
}
</script>
<style lang="scss" scoped></style>
